import { Resend } from "resend";
import { OTPVerifyEmail } from "../email/otp-template";

const resend = new Resend(process.env.RESEND_API_KEY);

export async function sendOTPVerifyEmail({ email, otp }: { email: string; otp: string }) {
  const { error } = await resend.emails.send({
    from: "React-Hono-Example <react-hono-example@wuchaochao.me>",
    to: [email],
    subject: "Login OTP",
    react: <OTPVerifyEmail verificationCode={otp} />,
  });
  return error;
}
